function ObstacleRow()
{
	this.COLUMNS = 24;
	this.Cells = new Array(this.COLUMNS);
	this.Y = -15;
	this.debug = false;
	this.Row = 0;
	this.boundsLowerY = 0;
}

ObstacleRow.prototype =
{
	populate: function() {
		this.clear();
		this.populate2();
		this.populate3();
	},

	populate1: function() {
		var c = Math.floor(randomRange(1, 14));
		for (var i = 0; i < c; i++)
		{
			if (this.debug)
				this.Cells[i] = 1;
			else
				this.Cells[i] = 2;
			this.debug = !this.debug;
		}
	},

	populate2: function() {
		var l = Math.floor(randomRange(1, 8));
		var r = Math.floor(randomRange(1, 8));
		for (var i = 0; i < l; i++)
		{
			this.Cells[i] = 1;
		}
		for (var i = this.COLUMNS - r; i < this.COLUMNS; i++)
		{
			this.Cells[i] = 1;
		}
	},

	populate3: function() {
		var c = Math.floor(randomRange(0, 24));
		var w = Math.floor(randomRange(5, 24));
		for (var i = c; i < w; i++)
		{
			if (i > this.COLUMNS)
				break;
			this.Cells[i] = 1;
		}
	},

	clear: function() {
		for (var i = 0; i < this.COLUMNS; i++)
		{
			this.Cells[i] = 0;
		}
	},

	updatePosition: function(posY) {
		this.Y += posY;
		//console.log(this.boundsLowerY);
		if (this.Y > this.boundsLowerY)
		{
			// Reset Y offset.
			this.Y = -15;
			// Gen a new row.
			this.populate();
		}
	},

	draw: function() {
		for (var i = 0; i < this.COLUMNS; i++)
		{
			if (this.Y > -7)
			{
				if (this.Cells[i] == 1)
				{
					ctx.fillStyle = "rgb(100,100,100)";
					ctx.fillRect((i * 8) + 1, this.Y, 8, 8);
				}
				else if (this.Cells[i] == 2)
				{
					ctx.fillStyle = "rgb(200,200,200)";
					ctx.fillRect((i * 8) + 1, this.Y, 8, 8);
				}
			}
		}
	}

};
